<template>
  <v-confirm v-model="showLoginConfirm" title="未登录提示" text="未登录,确认前往登录？" @confirm="goLogin"></v-confirm>
</template>

<script type="text/ecmascript-6">
  import Confirm from 'base/confirm/confirm'
  import {mapGetters, mapActions} from 'vuex'

  export default {
    data() {
      return {
        showLoginConfirm: false
      }
    },
    computed: {
      ...mapGetters([
        'confirmLogin'
      ])
    },
    methods: {
      goLogin() {
        this.$router.push('/login')
      },
      ...mapActions([
        'checkConfirmLogin'
      ])
    },
    components: {
      'v-confirm': Confirm
    },
    watch: {
      confirmLogin(val) {
        if (val === true) {
          this.showLoginConfirm = val
        }
      },
      showLoginConfirm(val) {
        if (val === false) {
          this.checkConfirmLogin(val)
        }
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss">

</style>
